﻿using HW_CommunicationLib.Enums;
using HW_CommunicationLib.Interface;
using HW_CommunicationLib.Model;
using System;
using System.Collections.Generic;
using System.IO.Ports;
using System.Linq;
using System.Net.Sockets;
using System.Text;
using System.Threading.Tasks;

namespace HW_CommunicationLib.Base
{
    ///<summary>
    ///描述: 
    ///作者: 孙小同
    ///创建时间: 2024/6/10 20:33:53
    ///</summary>
    public abstract class CommunicationBase : ICommunication
    {
        /// <summary>
        /// 通讯模式
        /// </summary>
        public CommunicationMode CommunicationMode { get; internal set; } = CommunicationMode.TCP;
        /// <summary>
        /// 网口通讯
        /// </summary>
        public TcpClient TcpClient { get; internal set; }

        /// <summary>
        /// 与下位机的连接状态
        /// </summary>
        public bool Connected { get; internal set; }
        /// <summary>
        /// 发送数据
        /// </summary>
        /// <param name="dataPackage"></param>
        public abstract DataPackage Send(DataPackage dataPackage);
        /// <summary>
        /// 开始
        /// </summary>
        /// <returns></returns>
        public abstract bool Start();
        /// <summary>
        /// 停止
        /// </summary>
        /// <returns></returns>
        public abstract bool Stop();
    }
}
